package cn.cs.service;

import cn.cs.mapper.ShopOrderMapper;
import cn.cs.pojo.ShopOrder;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;


@RestController
public class ShopOrderService {

    @Resource
    private ShopOrderMapper shopOrderMapper;

    @RequestMapping(value = "/getShopOrderById", method = RequestMethod.POST)
    @Transactional
    public ShopOrder getShopOrderById(@RequestParam("id") Long id)throws Exception{
        return shopOrderMapper.getShopOrderById(id);
    }

    @RequestMapping(value = "/getShopOrderByMap", method = RequestMethod.POST)
    @Transactional
    public List<Map<String,Object>> getShopOrderByMap(@RequestBody Map<String, Object> param)throws Exception{
        return shopOrderMapper.getShopOrderByMap(param);
    }

    @RequestMapping(value = "/getShopOrderDetails", method = RequestMethod.POST)
    @Transactional
    public List<Map<String,Object>>	getShopOrderDetails(@RequestParam("id") String id)throws Exception{
        return shopOrderMapper.getShopOrderDetails(id);
    }

    @RequestMapping(value = "/getShopOrderCountByMap", method = RequestMethod.POST)
    @Transactional
    public Integer getShopOrderCountByMap(@RequestBody Map<String, Object> param)throws Exception{
        return shopOrderMapper.getShopOrderCountByMap(param);
    }

    @RequestMapping(value = "/getShopOrderAgentByMap", method = RequestMethod.POST)
    @Transactional
    public List<Map<String,Object>>	getShopOrderAgentByMap(@RequestBody Map<String, Object> param)throws Exception{
        return shopOrderMapper.getShopOrderAgentByMap(param);
    }

    @RequestMapping(value = "/getShopOrderCountAgentByMap", method = RequestMethod.POST)
    @Transactional
    public Integer getShopOrderCountAgentByMap(@RequestBody Map<String, Object> param)throws Exception{
        return shopOrderMapper.getShopOrderCountAgentByMap(param);
    }

    @RequestMapping(value = "/itriptxAddShopOrder", method = RequestMethod.POST)
    @Transactional
    public Integer itriptxAddShopOrder(@RequestBody ShopOrder shopOrder)throws Exception{
        return shopOrderMapper.insertShopOrder(shopOrder);
    }

    @RequestMapping(value = "/itriptxModifyShopOrder", method = RequestMethod.POST)
    @Transactional
    public Integer itriptxModifyShopOrder(@RequestBody ShopOrder shopOrder)throws Exception{
        return shopOrderMapper.updateShopOrder(shopOrder);
    }

    @RequestMapping(value = "/itriptxDeleteShopOrderById", method = RequestMethod.POST)
    @Transactional
    public Integer itriptxDeleteShopOrderById(@RequestParam("id") Long id)throws Exception{
        return shopOrderMapper.deleteShopOrderById(id);
    }


    @RequestMapping(value = "/getShopIds", method = RequestMethod.POST)
    @Transactional
    public List<String> getShopIds(@RequestBody Map<String, Object> param){
        return shopOrderMapper.getShopIds(param);
    }
    @RequestMapping(value = "/insertShopOrder", method = RequestMethod.POST)
    @Transactional
    public int insertShopOrder(@RequestBody ShopOrder order) throws Exception {
        return shopOrderMapper.insertShopOrder(order);
    }
    @RequestMapping(value = "/updateCarProListState", method = RequestMethod.POST)
    @Transactional
    public int updateCarProListState(@RequestBody Map<String, Object> paramMap){
        return shopOrderMapper.updateCarProListState(paramMap);
    }
    @RequestMapping(value = "/getCarProCun", method = RequestMethod.POST)
    @Transactional
    public int getCarProCun(@RequestParam("carid")String carid)throws Exception{
        return shopOrderMapper.getCarProCun(carid);
    }
    @RequestMapping(value = "/updateCarStateFin", method = RequestMethod.POST)
    @Transactional
    public int updateCarStateFin(@RequestParam("carid")String carid)throws Exception{
        return shopOrderMapper.updateCarStateFin(carid);
    }
    @RequestMapping(value = "/insertOrder_pro_rel", method = RequestMethod.POST)
    @Transactional
    public int insertOrder_pro_rel(@RequestBody Map<String, Object> pro)throws Exception{
        return shopOrderMapper.insertOrder_pro_rel(pro);
    }


    @RequestMapping(value = "/getStateProByOutNum", method = RequestMethod.POST)
    int getStateProByOutNum(@RequestParam("shopOrdernum")String shopOrdernum){
        return shopOrderMapper.getStateProByOutNum(shopOrdernum);
    }
    @RequestMapping(value = "/updateShopOrderState", method = RequestMethod.POST)
    int updateShopOrderState(@RequestBody Map<String, Object> param){
        return shopOrderMapper.updateShopOrderState(param);
    }

}
